var direction_type= null
$(function () {
    $.when(getdatadictionary("direction_type")).done(
        vm.update()
	)
});
function getdatadictionary(sss)
{

    $.get(baseURL + "api/bdatadictionary/select?d_code="+sss, function(r){
        if(sss=="direction_type")
        {
            direction_type=r.returnlist;
        }

        vm.direction_type=direction_type;



    });
}
var vm = new Vue({
	el:'#rrapp',
	data:{
		showList: true,
		title: null,
		aPOther: {},
        status: ["是", "否"],
        direction_type:null
	},
	methods: {

		update: function (event) {

            vm.title = "修改";
            vm. direction_type=direction_type;
            vm.getInfo(GetUrlParam("guid"));
		},
		saveOrUpdate: function (event) {
			var url = vm.aPOther.guid == null ? "bss/apother/save" : "bss/apother/update";
			$.ajax({
				type: "POST",
			    url: baseURL + url,
                contentType: "application/json",
			    data: JSON.stringify(vm.aPOther),
			    success: function(r){
			    	if(r.code === 0){
						alert('操作成功', function(index){
							vm.reload();
						});
					}else{
						alert(r.msg);
					}
				}
			});
		},

		getInfo: function(guid){
			$.get(baseURL + "bss/apother/infoBypguid/"+guid, function(r){
                vm.aPOther = r.aPOther;
            });
		},
        getpOContent:function(event){

            var url =  "bss/apother/getpOContent" ;
            $.ajax({
                type: "POST",
                url: baseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.aPOther),
                success: function(r){
                    if(r.code === 0){
                        alert('操作成功', function(index){
                            vm.aPOther = r.aPOther;
                        });
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        getpODirection:function(event){

            var url =  "bss/apother/getpODirection" ;
            $.ajax({
                type: "POST",
                url: baseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.aPOther),
                success: function(r){
                    if(r.code === 0){
                        alert('操作成功', function(index){
                            vm.aPOther = r.aPOther;
                        });
                    }else{
                        alert(r.msg);
                    }
                }
            });
        }


	}
});